package cn.doitedu;

import java.util.ArrayList;
import java.util.List;


public class GenericTest {
    public static void main(String[] args) {
        //上界
        /*List<? extends Middle> lst = new ArrayList<>();
        lst.add(null);
        //add Low对象出错
        lst.add(new Low());
        lst.add(new Middle());
        Middle middle = lst.get(0);

        //下界
        List<? super Middle> lst2 = new ArrayList<>();
        lst2.add(new High());
        lst2.add(new Middle());
        lst2.add(new Low());
        Object object = lst2.get(0);*/

        ArrayList<Container<?>> lst = new ArrayList();
        Container<Middle> container = new Container<>();

        Container<Low> ct = new Container<>();
        lst.add(container);
    }

    public static <T extends Middle> void min(T t){

    }
    private  static  class Container<T> {

        public void add(T t){}


    }
    private static class High{

    }
    private static class Middle extends High{

    }
    private static class Low extends Middle{

    }
}
